﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace cnBlogs.Common.Helper
{
    public class LastAccessHelper
    {
        private const string LAKSY = "LeastAccess";
        private static DateTime _leastAccess;
        static LastAccessHelper()
        {
            Windows.Storage.ApplicationDataContainer roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
            if (roamingSettings.Values.ContainsKey(LAKSY))
            {
                _leastAccess = DateTime.Parse(roamingSettings.Values[LAKSY].ToString());
            }
            else
            {
                _leastAccess = DateTime.Today;
            }
            roamingSettings.Values[LAKSY] = DateTime.Now.ToString();
        }

        public static DateTime GetLastAccessTime()
        {
            return _leastAccess;
        }

    }
}
